﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace YArchitech.Plumbing
{
	internal class SinglePumpSelection : PumpSelConditionInfo
	{
		public virtual bool AutoSelPump(List<HYPumpData> lstPumps)
		{
			this.m_vecSelData.Clear();
			List<HYPumpData> list = new List<HYPumpData>();
			base.CheckFirst(lstPumps, ref list);
			HYPumpRange hypumpRange = new HYPumpRange();
			base.GetQRange(out hypumpRange.m_dMinQ, out hypumpRange.m_dMaxQ);
			base.GetHRange(out hypumpRange.m_dMinH, out hypumpRange.m_dMaxH);
			base.GetERange(out hypumpRange.m_dMinE, out hypumpRange.m_dMaxE);
			for (int i = 0; i < list.Count<HYPumpData>(); i++)
			{
				HYPumpData hypumpData = list[i];
				if (hypumpData.IsIn(hypumpRange))
				{
					hypumpData.m_leftPt.first = hypumpRange.m_dMinQ;
					hypumpData.m_leftPt.second = hypumpRange.m_dMaxQ;
					hypumpData.m_rightPt.first = hypumpRange.m_dMinH;
					hypumpData.m_rightPt.second = hypumpRange.m_dMaxH;
					if (base.CheckDrawAbility(hypumpData))
					{
						this.m_vecSelData.Add(hypumpData);
					}
				}
			}
			return true;
		}

		public List<HYPumpData> m_vecSelData = new List<HYPumpData>();
	}
}
